home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Rectangle;
- import java.io.DataInputStream;
- import java.io.IOException;
-
- final class ColTxt extends ColObj {
- private Color m_fillClr;
- private int m_rectWidth;
- private float m_rectX;
- private float m_rectY;
- private String m_txtStr;
- private ColGrph m_colGraphicObj;
- public Rectangle m_bounds;
-
- public void draw(Graphics var1) {
- int var2 = this.m_colGraphicObj.m_fontMtrc.stringWidth(this.m_txtStr);
- int var3 = (int)((float)this.m_rectWidth * this.m_colGraphicObj.m_mag);
- int var4 = var3 - var2;
- if (this.m_colGraphicObj.m_overrideColor != null) {
- var1.setColor(this.m_colGraphicObj.m_overrideColor);
- } else {
- var1.setColor(this.m_fillClr);
- }
-
- if ((var4 < 0 ? -var4 : var4) <= 4) {
- var1.drawString(this.m_txtStr, (int)((this.m_rectX + 0.5F - this.m_colGraphicObj.m_xOrg) * this.m_colGraphicObj.m_mag), (int)((this.m_rectY + 0.5F - this.m_colGraphicObj.m_yOrg) * this.m_colGraphicObj.m_mag));
- } else {
- int var5 = (int)((this.m_rectY + 0.5F - this.m_colGraphicObj.m_yOrg) * this.m_colGraphicObj.m_mag);
- float var6 = (this.m_rectX + 0.5F - this.m_colGraphicObj.m_xOrg) * this.m_colGraphicObj.m_mag;
- float var8 = 0.0F;
- new String();
- int var9 = this.m_txtStr.length();
- float var7 = (float)(var3 - var2) / (float)(var9 - 1);
-
- for(int var10 = 0; var10 < var9; ++var10) {
- String var11 = this.m_txtStr.substring(var10, var10 + 1);
- var1.drawString(var11, (int)(var6 + var8), var5);
- var8 += (float)this.m_colGraphicObj.m_fontMtrc.stringWidth(var11) + var7;
- }
-
- }
- }
-
- public int getType() {
- return 5;
- }
-
- public Rectangle getBounds() {
- return this.m_bounds;
- }
-
- public ColTxt(DataInputStream var1, int var2, ColGrph var3, Graphics var4) throws IOException {
- this.m_fillClr = Color.black;
- this.m_txtStr = new String();
- this.m_bounds = new Rectangle();
- this.m_colGraphicObj = var3;
- if ((var2 & 1) != 0) {
- this.m_fillClr = new Color(var1.readInt());
- }
-
- this.m_rectX = (float)var1.readShort() + (float)var1.readShort() / 65536.0F;
- this.m_rectY = (float)var1.readShort() + (float)var1.readShort() / 65536.0F;
- this.m_rectWidth = var1.readShort();
-
- for(int var5 = var1.readShort(); var5 > 0; --var5) {
- String var10001 = this.m_txtStr;
- this.m_txtStr = var10001 + (char)var1.readShort();
- }
-
- this.m_bounds.x = (int)this.m_rectX;
- this.m_bounds.width = this.m_colGraphicObj.m_fontMtrc.stringWidth(this.m_txtStr);
- this.m_bounds.height = this.m_colGraphicObj.m_fontMtrc.getLeading() + this.m_colGraphicObj.m_fontMtrc.getMaxAscent() + this.m_colGraphicObj.m_fontMtrc.getMaxDescent();
- this.m_bounds.y = (int)this.m_rectY - this.m_bounds.height;
- }
- }
-